#pragma once
#pragma once
#include<iostream>
#include<string>
using namespace std;


class Person {
protected:
	string m_name = "zjy";
	int m_age = 18;
public:
	Person(const string& name = "", int age = 0)
		:m_name(name), m_age(age) {}

	virtual ~Person() = default;

	const string& name()const 
	{ 
		return m_name; 
	}
	int age()const 
	{ 
		return m_age; 
	}
	void plusOneYear() 
	{ 
		++m_age;
	}
};
class PartTimeWorker final :public Person {
private:
	double m_hour;
	static double ms_payRate;
public:
	PartTimeWorker(const string& name, int age, double h = 0)
		:Person(name, age), m_hour(h) {}

	void setHours(double h)
	{ 
		m_hour = h; 
	}
	double saraly() 
	{ 
		return m_hour * ms_payRate; 
	}
};
double PartTimeWorker::ms_payRate = 7.53;

class Course {
	string m_name = "zjy";
	int m_score = 90;

public:
	Course(const string& name = "", int score = 0) :m_name(name), m_score(score)
	{}
	Course(const Course& rhs)
		:m_name(rhs.m_name),
		m_score(rhs.m_score)
	{
		cout << " Copy constr of Course " << endl;
	}
	void setScore(int score)
	{
		m_score = score;
	}
	int score()const
	{
		return m_score;
	}
	const string& name()const { return m_name; }
};



class Student final :public Person {
private:
	Course m_course;
public:
	Student() = default;
	Student(const string& name, int age, const Course& course) :Person(name, age), m_course(course) 
	{
		cout << "Constr of Student " << endl;
	}
	Course& course() 
	{ 
		return m_course; 
	}
};



